# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=tls-prober
pkgver=286.72b1029
pkgrel=3
pkgdesc='A tool to fingerprint SSL/TLS servers.'
groups=('blackarch' 'blackarch-fingerprint' 'blackarch-crypto')
arch=('any')
url='https://github.com/WestpointLtd/tls_prober'
license=('MIT')
depends=('python2')
makedepends=('git')
source=("$pkgname::git+https://github.com/WestpointLtd/tls_prober.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  git submodule update --init
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md doc/*
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf README.md doc LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 prober.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

